<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import { LoginApi } from "src/api";
import * as Api from "src/api/net";
export default {
  name: "App",
  watch: {
    // $route: "getPath"
  },
  methods: {
    // getPath() {
    //   let path = this.$route.path;
    //   let pointer = this;
    //   if (path == "/login" || path == "") {
    //     var postData = {};
    //     LoginApi.ajaxCheckLogin(postData, function(data) {
    //       if (data.code != 0) {
    //         pointer.$router.push({ path: "/main" });
    //       }
    //     });
    //   }
    // },
    logout() {
      // 箭头函数的this在定义时确定的
      LoginApi.ajaxLogout(data => {
        this.$message({ message: "注销成功", type: "success" });
        this.$router.push({ path: "/login" });
      });
    }
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  width: 100%;
  height: 100%;
}
html,
body {
  width: 100%;
  height: 99.5%;
}
html,
body,
ul,
li {
  padding: 0;
  margin: 0;
}

.h_middle {
  margin-left: auto;
  margin-right: auto;
  left: 0;
  right: 0;
}

ul,
li {
  list-style: none;
}
</style>
